<?php

namespace App\Http\Controllers\index;

use App\Http\Controllers\Controller;
use App\Models\Carousel;
use App\Models\WebConfig;
use Illuminate\Http\Request;

class IndexController extends Controller
{
    public function bannerList(): \Illuminate\Http\JsonResponse
    {
        $bannerList = Carousel::query()->where('type', 'banner')->get();
        $result = [
            'bannerList' => $bannerList,
        ];

        return $this->success($result);
    }


    public function config()
    {
        return $this->success(WebConfig::query()->where('id', 1)->first());
    }

    public function content()
    {
        return $this->success(Carousel::query()->where('type', 'content')->get());
    }

    public function video()
    {
        return $this->success(Carousel::query()->where([
            'type' => 'video',
            'position' => 'index',
        ])->first());
    }
}
